namespace ThingsGateway.Foundation.Rpc.TouchRpc
{
    /// <summary>
    /// 等待传输
    /// </summary>
    internal class WaitTransferPackage : WaitRouterPackage
    {
        /// <summary>
        /// 通道标识
        /// </summary>
        public int ChannelID { get; set; }

        /// <summary>
        /// 路径
        /// </summary>
        public string Path { get; set; }

        /// <summary>
        /// 流位置
        /// </summary>
        public long Position { get; set; }

        /// <summary>
        /// 事件Code
        /// </summary>
        public int EventHashCode { get; set; }

        public override void PackageBody(ByteBlock byteBlock)
        {
            base.PackageBody(byteBlock);
            byteBlock.Write(ChannelID);
            byteBlock.Write(Path);
            byteBlock.Write(Position);
            byteBlock.Write(EventHashCode);
        }

        public override void UnpackageBody(ByteBlock byteBlock)
        {
            base.UnpackageBody(byteBlock);
            this.ChannelID = byteBlock.ReadInt32();
            this.Path = byteBlock.ReadString();
            this.Position = byteBlock.ReadInt64();
            this.EventHashCode = byteBlock.ReadInt32();
        }
    }
}